﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace CommunitySystemModel
{
    [Serializable]
    [DataContract]
    public class Emp_BDGLModel
    {
        private int _Id;
         [DataMember]
        public int Id
        {
            get { return _Id; }
            set { _Id = value; }
        }
         private int _EId;
         [DataMember]
         public int EId
         {
             get { return _EId; }
             set { _EId = value; }
         }
         private string _Name;
         [DataMember]
         public string Name
         {
             get { return _Name; }
             set { _Name = value; }
         }
         private string _XB;
         [DataMember]
         public string XB
         {
             get { return _XB; }
             set { _XB = value; }
         }
         private string _ZZMM;
         [DataMember]
         public string ZZMM
         {
             get { return _ZZMM; }
             set { _ZZMM = value; }
         }
         private string _XRZW;
         [DataMember]
         public string XRZW
         {
             get { return _XRZW; }
             set { _XRZW = value; }
         }
         private string _NRZW;
         [DataMember]
         public string NRZW
         {
             get { return _NRZW; }
             set { _NRZW = value; }
         }
         private string _NMZW;
         [DataMember]
         public string NMZW
         {
             get { return _NMZW; }
             set { _NMZW = value; }
         }
         private string _RMLY;
         [DataMember]
         public string RMLY
         {
             get { return _RMLY; }
             set { _RMLY = value; }
         }
         private string _BZ;
         [DataMember]
         public string BZ
         {
             get { return _BZ; }
             set { _BZ = value; }
         }
         private string _CreateUser;
         [DataMember]
         public string CreateUser
         {
             get { return _CreateUser; }
             set { _CreateUser = value; }
         }
         private DateTime? _CreateDate;
         [DataMember]
         public DateTime? CreateDate
         {
             get { return _CreateDate; }
             set { _CreateDate = value; }
         }
         private int _OrgID;
         [DataMember]
         public int OrgID
         {
             get { return _OrgID; }
             set { _OrgID = value; }
         }

      
         private bool isselected = false;
         [DataMember]
         public bool IsSelected
         {
             get { return isselected; }
             set { isselected = value; }
         }
         private int _Sequence;
         [DataMember]
         public int Sequence
         {
             get { return _Sequence; }
             set { _Sequence = value; }
         }



         public static Emp_BDGLModel FillEntity(DataRow dr)
        {
            Emp_BDGLModel right = new Emp_BDGLModel();
            right.IsSelected = dr["IsSelected"].ToString() == "false" ? false : true;
            right.Sequence = Convert.ToInt32(dr["Sequence"]);
            if (dr.Table != null && dr.Table.Columns.Contains("Id")) right.Id = Convert.ToInt32(dr["Id"]);
            if (dr.Table != null && dr.Table.Columns.Contains("EId")) right.EId = Convert.ToInt32(dr["EId"]);
            if (dr.Table != null && dr.Table.Columns.Contains("Name")) if (!string.IsNullOrEmpty(dr["Name"].ToString())) right.Name = dr["Name"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("XB")) if (!string.IsNullOrEmpty(dr["XB"].ToString())) right.XB = dr["XB"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("ZZMM")) if (!string.IsNullOrEmpty(dr["ZZMM"].ToString())) right.ZZMM = dr["ZZMM"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("XRZW")) if (!string.IsNullOrEmpty(dr["XRZW"].ToString())) right.XRZW = dr["XRZW"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("NRZW")) if (!string.IsNullOrEmpty(dr["NRZW"].ToString())) right.NRZW = dr["NRZW"].ToString();
             if (dr.Table != null && dr.Table.Columns.Contains("OrgID")) right.OrgID = Convert.ToInt32(dr["OrgID"]);
             if (dr.Table != null && dr.Table.Columns.Contains("NMZW")) if (!string.IsNullOrEmpty(dr["NMZW"].ToString())) right.NMZW = dr["NMZW"].ToString();
             if (dr.Table != null && dr.Table.Columns.Contains("RMLY")) if (!string.IsNullOrEmpty(dr["RMLY"].ToString())) right.RMLY = dr["RMLY"].ToString();
            if (dr.Table != null && dr.Table.Columns.Contains("BZ")) if (!string.IsNullOrEmpty(dr["BZ"].ToString())) right.BZ = dr["BZ"].ToString();
          
            return right;
        }
    }
}
